package com.crm.service.impl.orderManager;

import com.crm.dao.mapper.customMapper.orderManagerCustomMapper.CustomerOrderInvoiceLogCustomMapper;
import com.crm.dao.mapper.orderManager.CustomerOrderInvoiceLogMapper;
import com.crm.model.entity.orderManager.CustomerOrderInvoiceLog;
import com.crm.model.entity.orderManager.CustomerOrderInvoiceLogExample;
import com.crm.service.orderManager.CustomerOrderInvoiceLogDbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * @Author:chaifuyou
 * @Date: 2021/7/28 9:17
 */
@Service
public class CustomerOrderInvoiceLogDbServiceImpl implements CustomerOrderInvoiceLogDbService {

    @Autowired
    private CustomerOrderInvoiceLogMapper customerOrderInvoiceLogMapper;

    @Autowired
    private CustomerOrderInvoiceLogCustomMapper customerOrderInvoiceLogCustomMapper;

    /**
     * 财务-新增开票信息记录
     * @param customerOrderInvoiceLog
     */
    @Override
    public void addOrderInvoiceLog(CustomerOrderInvoiceLog customerOrderInvoiceLog) {
        customerOrderInvoiceLogMapper.insertSelective(customerOrderInvoiceLog);
    }

    /**
     * 根据开票申请id查询已开票金额
     * @param chsCustomerOrderInvoiceId
     * @return
     */
    @Override
    public BigDecimal getSumApplyInvoiceMoney(String chsCustomerOrderInvoiceId) {
        return customerOrderInvoiceLogCustomMapper.getSumApplyInvoiceMoney(chsCustomerOrderInvoiceId);
    }
}
